import Alert from "./Alert";
export default {

    install: function (Vue) {
        //继承
        let Alerts = Vue.extend(Alert)
        //实例化一下获取我们的Alert组件
        let $abc = new Alerts()
        console.log($abc)
        let MyDiv = $abc.$mount().$el
        console.log($abc, MyDiv)

        document.body.appendChild(MyDiv);
        Vue.prototype.$xjj = {
            Show(options) {
                console.log(options)
                switch(options.type){
                    case "success":
                        $abc.flag=true;
                        $abc.Color="green";
                        MyDiv.innerHTML=options.con
                    break;
                    case "error":
                        $abc.flag=true;
                        $abc.Color="red";
                        MyDiv.innerHTML=options.con
                    break;
                };
                if(!options.timer){
                    setTimeout(() => {
                        $abc.flag=false;
                    },2000);
                }else{
                    setTimeout(() => {
                        $abc.flag=false;
                    },options.timer);
                }

            }


        }

    }

}